package com.kaishengit.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import com.kaishengit.pojo.Employee;
import com.kaishengit.service.EmployeeService;
@Results({
	@Result(name="login",location="employee.action",type="redirectAction"),
})
public class EmployeeAction {
	private Employee employee;
	private EmployeeService eservice;
	
	@Action("employee")
	public String execute(){
		return "index";
	}
	@Action("login")
	public String login(){
		Employee loginEmployee=eservice.save(employee);
		if(loginEmployee!=null){
			return "success";
		}else{
			return "login";
		}
		
	}
	@Autowired
	public void setEservice(EmployeeService eservice) {
		this.eservice = eservice;
	}
	//set get
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
}
